
import exceptions
class MiniUnitTestException(exceptions.Exception): pass
def assertEqual(a,b):
	if a!=b: raise MiniUnitTestException('assertEqual failed, %s != %s'%(a,b))
	print ('assertEqual pass (%s,%s)'%(a,b))
	return True
	
def assertThrow(fn, exceptionClass=None):
	try:
		fn()
	except exceptions.Exception,e:
		if exceptionClass and not isinstance(e, exceptionClass):
			raise MiniUnitTestException('assertThrow failed, raised wrong type of exception.')
		print ('assertThrow pass')
		return True
	raise MiniUnitTestException('assertThrow failed, did not raise exception.')